<div class='panel panel-default grid'>
	<div class='panel-heading'>
        <i class='fa fa-users fa-2x' style="margin-right: 10px"></i>队伍管理
       	<div class='panel-tools'>
       		<div class='btn-group'>
       			<a class='btn' onclick="createTeam()" title='新建'>
                  <i class='fa fa-plus fa-2x'></i>
                </a>
       			<a class='btn' onclick="getTeamInfo()" title='刷新'>
                  <i class='fa fa-rotate-left (alias) fa-2x'></i>
                </a>
       		</div>       		
       	</div>
    </div>
</div>
<div class="menu-body panel panel-default grid">
    <table class="table table-hover">
		<thead>
			<tr><th>队伍名</th><th>所属主题</th><th>队长</th><th>入场时间</th><th>通关时间</th><th>过期时间</th><th>是否公开</th><th style="width:120px">操作</th></tr>
		</thead>
		<tbody id="tbodyData">
		</tbody>
	</table>
</div>
<script type="text/html" id="lst_js">
{{if list==null || list.length==0 }}
	<div style="color: gray;text-align: center;width:100%">暂无数据</div>
{{else}}
	{{each list as value index}}
	<tr><td>{{value.teamname}}</td><td>{{value.themename}}</td><td>{{value.nickname}}</td><td>{{value.startdate}}</td><td>{{value.passDate}}</td><td>{{value.endDate}}</td><td>{{value.public}}</td><td class='action'><button class="btn btn-xs btn-info" onclick="showTeam({{value.teamId}})"><i class="fa fa-search"></i>详情</button><button class="btn btn-xs btn-info" onclick="modifyTeam({{value.teamId}})"><i class="fa fa-edit (alias)"></i>修改</button></td></tr>
	{{/each}}
{{/if}}
</script>
<script type="text/javascript">
	var dialog={
		popWidth : 900,
		src:"html/team_list_dialog.html",
		title:""
	};
	$(function(){
		getTeamInfo();
	});
	function getTeamInfo(){
		$("#tbodyData").empty();
		callSvr("team/getTeamList","", function(result) {
			var data={
				list:result
			};
			var html=template('lst_js',data);
			$("#tbodyData").html(html);
		});
	}
	function createTeam(){
		globalVariable.Operation = "create";
		dialog.title="新建队伍"
		Dialog=popWindowShow(dialog);
	}
	function showTeam(teamId){
		globalVariable.id=teamId;
		globalVariable.Operation = "show";
		dialog.title="查看队伍"
		Dialog=popWindowShow(dialog);
	}
	function modifyTeam(teamId){
		globalVariable.id=teamId;
		globalVariable.Operation = "modify";
		dialog.title="修改队伍"
		Dialog=popWindowShow(dialog);
	}
</script>

